﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace WebServices
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public void CreateUser(string name, string email)
        {
            CommonConnection.Instance().CreateConnection();
            CommonConnection.Instance().executeSQL("INSERT INTO User (Name,Email) VALUES ('" + name + "','" + email + "')");

        }

        [WebMethod]
        public void CreatePlace(string name, string description, float latitude, float longitude)
        {
            string location = "POINT(" + latitude + " " + longitude + ")";
            CommonConnection.Instance().CreateConnection();
            //CommonConnection.Instance().executeSQL("INSERT INTO Place (name,description,location) VALUES ('" + name + "','" + description + "',GeomFromText( '" + location + "'))");

            CommonConnection.Instance().executeSQL("INSERT INTO Place (name,description,location) VALUES ('"+name+"','"+description+"',GeomFromText( '"+location+"'))");

        }
    }
}
